package com.baosight.sczx.zm.cc.service; 
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.StaticBlocks;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.cc.domain.ZMCCProduceproblem; 
/**
 * 生产问题处理---历史记录
 */
public class ServiceZMCC12 extends ServiceEPBase {
	/**
	 * 初始化 
	 */
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		return outInfo;
	}
	/**
	 * 查询
	 */
	public EiInfo query(EiInfo inInfo)
	{
		
		String miningCode = UserSession.getInSessionProperty("miningCode").toString();
		StaticTools.setQueryParameters(inInfo, "fdMiningId", miningCode, true);
		StaticTools.setQueryParameters(inInfo, "isHandled", "yes", true);//所有作废\关闭的隐患
		EiInfo outInfo = super.query(inInfo, "ZMCCProduceproblem.query", new ZMCCProduceproblem());
		outInfo.addBlock(Department.getInstance().getMiningDepts("cmes.cp.department", "orgCode", "orgName", false,UserSession.getInSessionProperty("miningCode").toString()));//责任部门
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cp.problemType"));//问题类型
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cp.problemLevel"));//问题级别
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cp.problemOrigin"));//问题来源
		outInfo.addBlock(StaticBlocks.getBlockData("cmes.cp.problemStatus", new String[]{"0", "1", "2", "3", "4", "5", "6"}, new String[]{"草拟", "未处理", "未查收", "未整改", "未核查", "关闭", "作废"}, true));//问题状态
		outInfo.addBlock(StaticBlocks.getBlockData("cmes.cp.isCheck", new String[] { "否", "是" }, new String[] { "否", "是" }, true));// 是否重复问题
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.penaltyType")); // 是否罚款
		
		outInfo.set("departmentId", UserSession.getInSessionProperty("orgCode"));
		outInfo.set("departmentName", UserSession.getInSessionProperty("orgName"));
		return outInfo;
	}
}
